import java.util.*;
public class Practice3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] ss1 = sc.nextLine().toCharArray();
        char[] ss2 = sc.next().toCharArray();
        int[] hash = new int[256];
        for (int i = 0; i < ss1.length; i++) {
            hash[ss1[i]]++;
        }
        for (int i = 0; i < ss2.length; i++) {
            if(hash[ss2[i]] > 0){
                hash[ss2[i]] = 0;
            }
        }
        for (int i = 0; i < ss1.length; i++) {
            if(hash[ss1[i]]-- > 0){
                System.out.print(ss1[i]);
            }
        }
    }
}
